
class Solution {
public:
    vector<int> twoSum(vector<int>& nums, int target) {
        unordered_map<int, int> buffer;
        for (int i = 0; i < nums.size(); ++i) {
            buffer[nums[i]] = i;
        }

        for (int i = 0; i < nums.size(); i++) {
            if (buffer.count(target - nums[i]) && i != buffer[target - nums[i]])return{ i,buffer[target - nums[i]] };
        }
        return{ -1,-1 };
    }
};